import Vue from 'vue';
import Router from 'vue-router';
// 引入组件
import ShoppingMall from '../components/pages/ShoppingMall';
import Map from '../components/pages/Map';
import Register from '../components/pages/Register';
import Login from '../components/pages/Login';
import GoodsDetail from '../components/pages/GoodsDetail';
import CategoryList from '../components/pages/CategoryList';
import ShopCar from "../components/pages/ShopCar";
import Home from '../components/pages/Home';
import MemberCenter from '../components/pages/MemberCenter';
import PersonalInfo from '../components/pages/PersonalInfo';
import Address from '../components/pages/Address';
import AddAddress from '../components/component/AddAddress';
import Purchase from '../components/pages/Purchase';
import Chat from '../components/pages/Chat';
import Coupons from '../components/component/Coupons';
import SearchGoods from '../components/pages/SearchGoods';
import NotFound from '../components/pages/NotFound';

Vue.use(Router)

export default new Router({
  mode: 'history', // 'history/hash(默认值)'
  routes: [{
    name: 'Home',
    path: '/',
    component: Home,
    // 子路由
    children: [{
      name: 'ShoppingMall',
      path: '/',
      component: ShoppingMall,
    }, {
      name: 'CategoryList',
      path: '/categoryList',
      component: CategoryList,
    }, {
      name: 'ShopCar',
      component: ShopCar,
      path: '/shopCar',
    }, {
      name: 'MemberCenter',
      path: '/memberCenter',
      component: MemberCenter,
    }],
  }, {
    name: 'Register',
    path: '/register',
    component: Register,
  }, {
    name: 'Login',
    path: '/login',
    component: Login,
  }, {
    name: 'PersonalInfo',
    path: '/personalInfo',
    component: PersonalInfo,
  }, {
    name: 'GoodsDetail',
    path: '/goodsDetail',
    component: GoodsDetail,
  }, {
    name: 'Map',
    path: '/map',
    component: Map,
  }, {
    name: 'Address',
    path: '/address',
    component: Address,
  }, {
    name: 'AddAddress',
    path: '/addAddress',
    component: AddAddress,
  }, {
    name: 'Purchase',
    path: '/purchase',
    component: Purchase,
  }, {
    name: 'Chat',
    path: '/chat',
    component: Chat,
  }, {
    path: '/coupons',
    name: 'Coupons',
    component: Coupons
  }, {
    path: '/searchGoods',
    name: 'SearchGoods',
    component: SearchGoods,
  }, {
    path: '*',
    name: 'NotFound',
    component: NotFound,
  }]
})
